/*
 * @Author: zhangyang
 * @Date: 2022-04-14 11:47:52
 * @LastEditTime: 2022-04-15 10:15:35
 * @Description: 
 */
// polyfill
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import { ViteSSG } from 'vite-ssg'
import generatedRoutes from 'virtual:generated-pages'
import { setupLayouts } from 'virtual:generated-layouts'
import App from './App.vue'

import '@unocss/reset/tailwind.css'
import './styles/main.module.scss'
import 'uno.css'

const routes = setupLayouts(generatedRoutes)

// `export const createApp` is required instead of the original `createApp(App).mount('#app')`
export const createApp = ViteSSG(
  // the root component
  App,
  // vue-router options
  { routes, base: import.meta.env.BASE_URL },
  // function to have custom setups
  (ctx) => {
    Object.values(
      import.meta.globEager('./modules/*.ts')
    ).map((m) => m.install?.(ctx))
  },
)
